package com.hjc.business.contorller;

import com.hjc.business.dao.impl.TaskDaoImpl;
import com.hjc.business.mdoel.Task;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: HJC
 * Date: 2019/11/20
 * Time: 19:29
 * To change this template use File | Settings | File Templates.
 */
public class QueryCtl implements Action {
    private TaskDaoImpl taskDao = new TaskDaoImpl();

    // global
    private List<Task> query;

    public List<Task> getQuery() {
        return query;
    }

    public void setQuery(List<Task> query) {
        this.query = query;
    }

    @Override
    public String execute() throws Exception {
        query = taskDao.find(null);
        ActionContext.getContext().get("request");
        return null;
    }
    ///queryInfo
    public String queryInfo(){
        query = taskDao.find(null);
        System.out.println("enter");
        HttpServletRequest request = (HttpServletRequest) ActionContext.getContext().get("request");
        request.setAttribute("userinfo",query);
        return "true";
    }
}
